<div class="container">
  <h1>form_checkbox()</h1>
  <p class="signature">function form_checkbox(string $name, mixed $value = '1', mixed $checked = false, ?array $attributes = null): string</p>
  <h2>Description</h2>
  <div class="description">
    <p>Generates a checkbox form field element.</p>
  </div>
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>$name</td>
        <td>string</td>
        <td>The name attribute for the input element.</td>
      </tr>
      <tr>
        <td>$value</td>
        <td>mixed</td>
        <td>(optional) The value attribute for the input element. Default is '1'.</td>
      </tr>
      <tr>
        <td>$checked</td>
        <td>mixed</td>
        <td>(optional) Whether the checkbox should be checked. Can be boolean, string, or any truthy/falsy value. Default is false.</td>
      </tr>
      <tr>
        <td>$attributes</td>
        <td>array|null</td>
        <td>(optional) Additional attributes for the input element as an associative array. Default is null.</td>
      </tr>
    </tbody>
  </table>
  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>string</td>
        <td>The generated HTML input element.</td>
      </tr>
    </tbody>
  </table>
  <h2>Example #1</h2>
  <p>The code sample below demonstrates the basic usage of the <code>form_checkbox</code> function with default parameters.</p>
  <pre>
$name = 'subscribe';
echo form_checkbox($name);
// Output: '&lt;input type="checkbox" name="subscribe" value="1"&gt;'
  </pre>
  <h2>Example #2</h2>
  <p>The code sample below demonstrates a more complex usage of the <code>form_checkbox</code> function with additional attributes.</p>
  <pre>
$name = 'subscribe';
$value = 'yes';
$checked = true;
$attributes = [
    'class' => 'checkbox-input', 
    'id' => 'subscribe-checkbox', 
    'disabled' => 'disabled',
    'data-toggle' => 'tooltip',
    'data-placement' => 'top',
    'title' => 'Subscribe to newsletter'
];
echo form_checkbox($name, $value, $checked, $attributes);
// Output: '&lt;input type="checkbox" name="subscribe" value="yes" checked class="checkbox-input" 
//         id="subscribe-checkbox" disabled data-toggle="tooltip" data-placement="top" 
//         title="Subscribe to newsletter"&gt;'
  </pre>
</div>